
<?php include './application/views/top.php'; ?>
<script src="/static/js/ajaxfileupload.js"></script>
<script src="/static/js/My97DatePicker/WdatePicker.js"></script>

<div class="clear"></div>
<div class="user_bottom all"></div>
<div class="clear h50"></div>
<div class="layout uc">
	<?php include './application/views/user/left.php'; ?>
	<div class="right">
		<div class="menu_list"><?php include './application/views/user/menu.php'; ?></div>
		<?php
			$sex = array(
				'0'=>'',
				'1'=>'男',
				'2'=>'女',
				);
		?>
		<div class="cont">
			<form id="myform">
			<input type="hidden" name="act" value="<?php echo $act;?>">
			<input type="hidden" name="submit" value="1">
            <?php if($act == '' || $act== 'index'){ ?>
			<dl>
				<dt>用户名：</dt>
                <dd><?php echo $user['username']; ?></dd>
			</dl>
            <dl>
            	<dt>性 别：</dt>
                <dd>
                <input type="radio" name="sex" value="1" <?php if($user['sex'] == 1) echo "checked"?>><label>男</label>
                <input type="radio" name="sex" value="2" <?php if($user['sex'] == 2) echo "checked"?>><label>女</label>
                </dd>
            </dl>
			<dl>
				<dt>手机号码：</dt>
                <dd><?php echo $user['phone'] ? $user['phone'] : '-'; ?></dd>
			</dl>
			<dl>
				<dt>籍贯：</dt>
                <dd>
                <select class="pubinput" name="province" id="province" onchange="getChild(this.value,'','city');"><option value="">请选择</option></select>
                <select class="pubinput" name="city" id="city" onchange="getChild(this.value,'','area');"><option value="">请选择</option></select>
                <select class="pubinput" name="area" id="area"><option value="">请选择</option></select>
                </dd>
			</dl>
			<dl class="line">
				<dt>个人描述：</dt>
                <dd><textarea name="user_desc" rows="7" cols="50"><?php echo isset($userinfo['user_desc']) ? $userinfo['user_desc'] : ''; ?></textarea></dd>
			</dl>
            <?php }elseif($act == 'contact'){ ?>
			<dl>
				<dt>最高学历：</dt>
                <dd><select name="education_record" id="education_record" class="pubinput"></select></dd>
			</dl>
			<dl>
				<dt>毕业院校：</dt>
                <dd><input type="text" class="input" name="education_school" value="<?php echo @$userinfo['education_school'];?>"></dd>
			</dl>
			<dl>
				<dt>入学年份：</dt>
                <dd>
				<input type="text" class="input" value="<?php echo isset($userinfo['education_time1']) ? date('Y-m-d',$userinfo['education_time1']) : ''; ?>" name="education_time1" onfocus="WdatePicker()" readonly>
				到
                <input type="text" class="input" value="<?php echo isset($userinfo['education_time2']) ? date('Y-m-d',$userinfo['education_time2']) : ''; ?>" name="education_time2" onfocus="WdatePicker()" readonly>
                </dd>
			</dl>
			<dl>
				<dt>婚姻状况：</dt>
                <dd><select name="marry" id="marry" class="pubinput"></select></dd>
			</dl>
			<dl>
				<dt>有无子女：</dt>
                <dd><select name="child" id="child" class="pubinput"></select></dd>
			</dl>
			<dl>
				<dt>有无社保：</dt>
                <dd><select name="safe" id="safe" class="pubinput"></select></dd>
			</dl>
			<dl>
				<dt>是否有房：</dt>
                <dd><select name="house" id="house" class="pubinput"></select></dd>
			</dl>
			<dl>
				<dt>是否有车：</dt>
                <dd><select name="car" id="car" class="pubinput"></select></dd>
			</dl>
			<dl>
				<dt>居住地所在：</dt>
                <dd>
				<select name="province" id="province" class="pubinput" onchange="getArea(this.value,'','city');"></select>
				<select name="city" id="city" onchange="getArea(this.value,'','area');"><option value="">请选择</option></select>
				<select name="area" id="area"><option value="">请选择</option></select>
                </dd>
			</dl>
			<dl>
				<dt>现居住地址：</dt>
                <dd><input type="text" class="input" name="address" maxlength="30" value="<?php echo isset($userinfo['address']) ? $userinfo['address'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>居住地电话：</dt>
                <dd><input type="text"  class="input" name="tel" maxlength="20" value="<?php echo isset($userinfo['tel']) ? $userinfo['tel'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>QQ：</dt>
                <dd><input type="text" class="input" name="qq" maxlength="11" value="<?php echo isset($userinfo['qq']) ? $userinfo['qq'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>旺旺：</dt>
                <dd><input type="text" class="input" name="wangwang" maxlength="20" value="<?php echo isset($userinfo['wangwang']) ? $userinfo['wangwang'] : '';?>"></dd>
			</dl>
            <?php }elseif($act == 'company'){ ?>
			<dl>
				<dt>公司名称：</dt>
                <dd><input type="text" class="input" name="company_name" maxlength="20" value="<?php echo isset($userinfo['company_name']) ? $userinfo['company_name'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>公司性质：</dt>
                <dd><select name="company_type" class="pubinput" id="company_type"></select></dd>
			</dl>
			<dl>
				<dt>职位状态：</dt>
                <dd><select name="company_office" class="pubinput" id="company_office"></select></dd>
			</dl>
			<dl>
				<dt>月收入：</dt>
                <dd><select name="income" class="pubinput" id="income"></select></dd>
			</dl>
			<dl>
				<dt>公司规模：</dt>
                <dd><input type="text" class="input" name="company_employee" value="<?php echo isset($userinfo['company_employee']) ? $userinfo['company_employee'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>公司电话：</dt>
                <dd><input type="text" class="input" name="company_tel" maxlength="20" value="<?php echo isset($userinfo['company_tel']) ? $userinfo['company_tel'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>公司地址：</dt>
                <dd><input type="text" class="input" name="company_address" maxlength="30" value="<?php echo isset($userinfo['company_address']) ? $userinfo['company_address'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>公司网站：</dt>
                <dd><input type="text" class="input" name="company_weburl" maxlength="30" value="<?php echo isset($userinfo['company_weburl']) ? $userinfo['company_weburl'] : '';?>"></dd>
			</dl>
			<dl class="line fb">
				<dt>直接亲属联系人一</dt>
                <dd></dd>
			</dl>
			<dl>
				<dt>姓名：</dt>
                <dd><input type="text" class="input" name="linkman1" maxlength="10" value="<?php echo isset($userinfo['linkman1']) ? $userinfo['linkman1'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>关系：</dt>
                <dd><select name="relation1" class="pubinput" id="relation1"></select></dd>
			</dl>
			<dl>
				<dt>手机：</dt>
                <dd><input type="text" class="input" name="phone1" maxlength="20" value="<?php echo isset($userinfo['phone1']) ? $userinfo['phone1'] : '';?>"></dd>
			</dl>
			<dl class="line fb">
				<dt>直接亲属联系人二</dt>
                <dd></dd>
			</dl>
			<dl>
				<dt>姓名：</dt>
                <dd><input type="text" class="input" name="linkman2" maxlength="10" value="<?php echo isset($userinfo['linkman2']) ? $userinfo['linkman2'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>关系：</dt>
                <dd><select name="relation2" class="pubinput" id="relation2"></select></dd>
			</dl>
			<dl>
				<dt>手机：</dt>
                <dd><input type="text" class="input" name="phone2" maxlength="20" value="<?php echo isset($userinfo['phone2']) ? $userinfo['phone2'] : '';?>"></dd>
			</dl>
            <?php }elseif ($act == 'qiye'){ ?>
			<dl>
				<dt>企业性质：</dt>
                <dd><select name="qiye_type" id="qiye_type" class="pubinput"></select></dd>
			</dl>
			<dl>
				<dt>企业名称：</dt>
                <dd><input type="text" class="pubinput" name="qiye_name" value="<?php echo isset($userinfo['qiye_name']) ? $userinfo['qiye_name'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>企业规模：</dt>
                <dd><input type="text" class="pubinput" name="qiye_employee" value="<?php echo isset($userinfo['qiye_employee']) ? $userinfo['qiye_employee'] : '';?>"></dd>
			</dl>
			<dl>
				<dt>注册资本：</dt>
                <dd><input type="text" class="pubinput" name="zhuce" maxlength="20" value="<?php echo isset($userinfo['zhuce']) ? $userinfo['zhuce'] : '';?>"></dd>
			</dl>
			<dl class="line">
				<dt>经营状况：</dt>
                <dd><textarea name="nianjian"><?php echo isset($userinfo['nianjian']) ? $userinfo['nianjian'] : ''; ?></textarea></dd>
			</dl>
			<dl class="line">
				<dt>经营范围：</dt>
                <dd><textarea name="fanwei"><?php echo isset($userinfo['fanwei']) ? $userinfo['fanwei'] : ''; ?></textarea></dd>
			</dl>
			<dl class="line">
				<dt>企业背景：</dt>
                <dd><textarea name="qiye_background"><?php echo isset($userinfo['qiye_background']) ? $userinfo['qiye_background'] : ''; ?></textarea></dd>
			</dl>
            <?php } ?>
            <div class="cb"><input class="button" type="button" value="确认提交" onclick="toSubmit();" /></div>
            </form>
		</div>
        

	</div>
</div>
<div class="clear h50"></div>
<?php include "./application/views/footer.php";?>
<script>
                            //加载籍贯地址选项

                            $(document).ready(function(){
                                getChild(0,'<?php echo isset($user['province'])?$user['province']:''; ?>','province');
                                <?php if(isset($user['city']) && $user['city']){ ?>
                                getChild('<?php echo $user['province']; ?>','<?php echo $user['city']; ?>','city');
                                <?php } ?>

                                <?php if(isset($user['area']) && $user['area']){ ?>
                                getChild('<?php echo $user['city']; ?>','<?php echo $user['area']; ?>','area');
                                <?php } ?>
                            });

                            <?php if($act == 'contact') {?>
                            $(document).ready(function(){
                                getLinkage('3','<?php echo isset($userinfo['education_record']) ? $userinfo['education_record'] : ''; ?>','education_record');
                                getLinkage('1','<?php echo isset($userinfo['marry']) ? $userinfo['marry'] : ''; ?>','marry');
                                getLinkage('2','<?php echo isset($userinfo['child']) ? $userinfo['child'] : ''; ?>','child');
                                getLinkage('5','<?php echo isset($userinfo['safe']) ? $userinfo['safe'] : ''; ?>','safe');
                                getLinkage('6','<?php echo isset($userinfo['house']) ? $userinfo['house'] : ''; ?>','house');
                                getLinkage('7','<?php echo isset($userinfo['car']) ? $userinfo['car'] : ''; ?>','car');

                                getArea(0,'<?php echo isset($userinfo['province'])?$userinfo['province']:''; ?>','province');
                                <?php if(isset($userinfo['city']) && $userinfo['city']){ ?>
                                getArea('<?php echo $userinfo['province']; ?>','<?php echo $userinfo['city']; ?>','city');
                                <?php } ?>

                                <?php if(isset($userinfo['area']) && $userinfo['area']){ ?>
                                getArea('<?php echo $userinfo['city']; ?>','<?php echo $userinfo['area']; ?>','area');
                                <?php } ?>
                            });

                            <?php }elseif($act == 'company'){?>

                            $(document).ready(function(){
                                getLinkage('10','<?php echo isset($userinfo['company_type'])?$userinfo['company_type']:''; ?>','company_type');
                                getLinkage('13','<?php echo isset($userinfo['company_office'])?$userinfo['company_office']:''; ?>','company_office');
                                getLinkage('4','<?php echo isset($userinfo['income'])?$userinfo['income']:''; ?>','income');

                                getLinkage('18','<?php echo isset($userinfo['relation1'])?$userinfo['relation1']:''; ?>','relation1');
                                getLinkage('18','<?php echo isset($userinfo['relation2'])?$userinfo['relation2']:''; ?>','relation2');

                            });

                            <?php }elseif ($act == 'qiye'){?>
                            $(document).ready(function(){
                                getLinkage('10','<?php echo isset($userinfo['qiye_type'])?$userinfo['qiye_type']:''; ?>','qiye_type');
                            });
                            <?php }?>
                            function getLinkage(type_id, selected, obj){
                                $.ajax({
                                    type: "POST",
                                    url: "/linkage/get_option",
                                    data: "type_id="+type_id+"&selected="+selected,
                                    success: function(msg){
                                        $("#"+obj).html(msg);
                                    },
                                    dataType: "text"
                                });
                            }

                            function getArea(pid, selected, obj){
                                $.ajax({
                                    type: "POST",
                                    url: "/area/get_option",
                                    data: "pid="+pid+"&selected="+selected,
                                    success: function(msg){
                                        $("#"+obj).html(msg);
                                    },
                                    dataType: "text"
                                });
                            }

                            function toSubmit(){
                                var url = '/user/info/<?php echo $act?>';
                                var options = {
                                    url : url,
                                    clearForm :true,
                                    resetForm :true,
                                    //beforeSubmit:  checkForm,
                                    dataType: "json",
                                    type:"post",
                                    success : function(ret) {
                                        $('#dialog').dialog({
                                            modal:true,
                                            title:'系统提示',
                                            buttons:{"确定":function(){$(this).dialog("close");}},
                                            close: function() {
                                                location=ret.url;
                                            }
                                        });
                                        $("#msg").html(ret.msg);
                                    }
                                };
                                $("#myform").ajaxSubmit(options);
                                return false;
                            }

                            function getChild(pid, selected,obj){
                                $.ajax({
                                    type: "POST",
                                    url: "/area/get_option",
                                    data: "pid="+pid+"&selected="+selected,
                                    success: function(msg){
                                        $("#"+obj).html(msg);
                                    },
                                    dataType: "text"
                                });
                            }

                        </script>